import { Quasar } from "quasar";
import common from "_s/common/localstore";
const langRaw = common.getLang();
const lang = typeof langRaw === "string" && langRaw ? langRaw : "en-US"; // fallback to 'en-US' or your default
// 这个路径相对于您的 node_modules/quasar/..
const langList = import.meta.glob("../../node_modules/quasar/lang/*.js");
console.log(langList);
// or just a select few (example below with only DE and FR):
// import.meta.glob('../../node_modules/quasar/lang/(de|fr).mjs')

export default () => {
  try {
    const langLoader = langList[`../../node_modules/quasar/lang/${lang}.js`];
    if (langLoader) {
      void langLoader().then(lang => {
        // @ts-expect-error: lang.default type may not match expected type
        Quasar.lang.set(lang.default);
      });
    }
  } catch {
    // Requested Quasar Language Pack does not exist,
    // let's not break the app, so catching error
  }
};
